import {ReactCurrentDispatcher} from "react/src/ReactCurrentDispatcher";

function resolveDispatch(){
    return ReactCurrentDispatcher.current
}

const useReducer=function (reducer,initialArg){
    let dispatch=resolveDispatch()
    return dispatch.useReducer(reducer,initialArg)
}

const useState=function (initialArg){
    let dispatch=resolveDispatch()
    return dispatch.useState(initialArg)
}

const useEffect=function (create,deps){
    let dispatch=resolveDispatch()
    return dispatch.useEffect(create,deps)
}

export {useReducer,useState,useEffect}